home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_blockrise.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  300 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_blockrise
  4. #
  5. # For the sinkblock puzzle in the tunnels between the pyramids
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13. message        startup
  14. message        activated
  15. message        entered
  16. message        exited
  17. message        timer
  18. message        pulse
  19.  
  20. # world things
  21. thing    player        local
  22. thing    button
  23. thing    sinkblock                    # column that rises and falls
  24. thing    lowerblock    nolink            # pushblock that keeps column from falling
  25. thing    pushblocker    nolink            # makes bottom block unpushable with sayline from Indy
  26.  
  27. # camera things
  28. thing    buttoncam
  29. thing    buttonlook
  30. thing    blockcam
  31. thing    blockcamlook
  32. thing    cam1spot    local
  33. thing    cam1look    local
  34.  
  35. # hint things
  36. thing    hint24
  37. thing    hint25
  38. thing    hint26
  39.  
  40. # world surfaces
  41. surface    lowblockstart    mask=0x080
  42. surface    lowblockend        mask=0x080
  43. surface    hangledge    nolink
  44. surface    nohangface    nolink
  45.  
  46. # sectors
  47. sector    sinkblocksector    nolink
  48.  
  49. # sounds
  50. sound    stomperdown=olv_rockhead_hitearth_c.wav            local
  51. sound    indycrush=fol_in_landhurt.wav                    local
  52. sound    indycrush2=fol_in_landpuddle.wav                local
  53. sound    warningcreak=riv_elev_wheel_engage.wav    local
  54.  
  55. # variables
  56. int        locked=0        local
  57. int        sinkerwaiting=0    local
  58. int        pulled=0        local
  59. int        pushermoving=0    local
  60. int        counter=10    local
  61.  
  62. # subroutines
  63. flex    startscene=0.0        local
  64. flex    endscene=0.0        local
  65. flex    fixcams=0.0            local
  66. end
  67.  
  68.  
  69. code
  70. startup:
  71.     SetThingLight(button, '1.2 1.2 .8', .001, .01);
  72.     SetAdjoinFlags(hangledge, 2);
  73.     SetAdjoinFlags(nohangface, 2);
  74.     return;
  75.  
  76. activated:
  77. # ---> button
  78.  
  79.     if (GetSenderRef() != button) return;
  80.     if (locked) return;
  81.  
  82.     player = GetLocalPlayerThing();
  83.     
  84.     # prepare player
  85.     if (MakeMeStop() == -1) return;
  86.     DeselectWeaponWait(player);
  87.     
  88.     StartCutscene(1);
  89.     locked = 1;
  90.     
  91.     # setup offset camera
  92.     cam1spot = CreateThing(GetThingTemplate(buttoncam), buttoncam);
  93.     cam1look = CreateThing(GetThingTemplate(buttoncam), buttoncam);
  94.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  95.     SetCameraLookInterp(2, 0);
  96.     SetCameraPosInterp(2, 0);
  97.     SetCameraFocus(2, cam1spot);
  98.     SetCameraSecondaryFocus(2, cam1look);
  99.     SetCurrentCamera(2);
  100.     ResetCameraFOV(0, 0.0);
  101.     SetCameraLookInterp(2, 1);
  102.     SetCameraPosInterp(2, 1);
  103.     SetCameraInterpSpeed(2, 0.7);
  104.     Sleep(0.01);
  105.     SetCameraFocus(2, buttoncam);
  106.     SetCameraSecondaryFocus(2, buttonlook);
  107.     
  108.     #Move camera, push button
  109.     Sleep(.25);
  110.     PlayMode(player, 60, 0);
  111.     Sleep(.25);
  112.     MoveToFrame(button, 1, 2);
  113.     WaitForStop(button);
  114.  
  115.     # solve hint 24
  116.     SetHintSolved(hint24);
  117.  
  118.     # get ready to jump to block cam
  119.     sleep(.5);
  120.     call startscene;
  121.     
  122.     # Move sinkblock up with collision off
  123.     SetCollideType(sinkblock, 0);
  124.     SetCollideType(lowerblock, 0);
  125.     PlaySoundThing(warningcreak, sinkblock, 1, -1, -1, 0);
  126.     MoveToFrame(sinkblock, 1, 4);
  127.     WaitForStop(sinkblock);
  128.     Sleep(1);
  129.  
  130.     # make sure shimmy ledge doesn't work
  131.     SetAdjoinFlags(hangledge, 2);
  132.     SetAdjoinFlags(nohangface, 2);
  133.  
  134.     # restore camera and get rid of objects
  135.     SetCameraLookInterp(2, 0);
  136.     SetCameraPosInterp(2, 0);
  137.     SetCameraPosition(1, GetThingPos(buttoncam));
  138.     SetCurrentCamera(1);
  139.     DestroyThing(cam1spot);
  140.     DestroyThing(cam1look);
  141.  
  142.     # restore control to player
  143.     ClearActorFlags(player, 0x200000);
  144.     EndCutscene();
  145.  
  146.     # restore collision
  147.     SetCollideType(sinkblock, 3);
  148.     SetCollideType(lowerblock, 3);
  149.     
  150.     # make pushblock push/pullable
  151.     SetThingFlags(pushblocker, 0x80000);
  152.     
  153.     # set timer to make block fall again
  154.     # timer ranges from 15 on hard to 25 on easy, minus the sound of the warning creak
  155.     SetTimer(25 - (2 * GetDifficulty()) - GetSoundLen(warningcreak));
  156.     return;
  157.  
  158. timer:
  159.     # if lower pushblock en route, make sinkblock pause until it's there
  160.     if (pushermoving)
  161.     {
  162.         sinkerwaiting = 1;
  163.         return;
  164.     }
  165.  
  166.     PlaySoundThing(warningcreak, sinkblock, 1, -1, -1, 0);
  167.     Sleep(GetSoundLen(warningcreak) - .5);
  168.     
  169.     # turn collision off in order to send sinkblock down
  170.     SetCollideType(sinkblock, 0);
  171.     SetCollideType(lowerblock, 0);
  172.     
  173.     # if lower pushblock is out
  174.     if (pulled)
  175.     {
  176.         # make sinkblock fall onto pushblock
  177.         MoveToFrame(sinkblock, 2, 10);
  178.         WaitForStop(sinkblock);
  179.         SetPulse(.1);
  180.  
  181.         # cover engine shimmy bug
  182.         ClearAdjoinFlags(hangledge, 2);
  183.         ClearAdjoinFlags(nohangface, 2);
  184.     
  185.         # solve hint 25
  186.         SetHintSolved(hint25);
  187.     }
  188.     else
  189.     {
  190.         # make sinkblock fall to floor
  191.         MoveToFrame(sinkblock, 0, 10);
  192.         WaitForStop(sinkblock);
  193.  
  194.         # if puzzle has never been fully solved, reset initial hints
  195.         if (GetHintSolved(hint26) == 0)
  196.         {
  197.             SetHintUnsolved(hint24);
  198.             SetHintUnsolved(hint25);
  199.         }
  200.  
  201.         # cover engine shimmy bug
  202.         SetAdjoinFlags(hangledge, 2);
  203.         SetAdjoinFlags(nohangface, 2);
  204.  
  205.         # make some shakey
  206.         PlaySoundThing(stomperdown, sinkblock, 1, -1, -1, 0);
  207.         SetPulse(.1);
  208.     }    
  209.     
  210.     # if Indy is below sinkblock, kill him!
  211.     if (GetThingSector(player) == sinkblocksector)
  212.     {
  213.         DamageThing(player, 1000, 0x1, player);
  214.         PlaySoundLocal(stomperdown, 1, 0, 0x0, 0);
  215.         PlaySoundLocal(indycrush, 1, 0, 0x0, 0);
  216.         PlaySoundLocal(indycrush2, 1, 0, 0x0, 0);
  217.         SetPulse(.1);
  218.         
  219.         sleep(.01);
  220.     
  221.         SetThingFlags(player, 0x80000);
  222.     }
  223.     
  224.     SetCollideType(sinkblock, 3);
  225.     SetCollideType(lowerblock, 3);
  226.     
  227.     # make pushblock non-push/pullable
  228.     ClearThingFlags(pushblocker, 0x80000);
  229.     
  230.     MoveToFrame(button, 0, 2);
  231.     WaitForStop(button);
  232.     locked = 0;
  233.  
  234.     return;
  235.     
  236. entered:
  237. # ---> either of two pushblock faces (masked for pushblocks only)    
  238.  
  239.     pushermoving = 0;
  240.  
  241.     # if block is back where it started, it's not "pulled"
  242.     if (GetSenderRef() == lowblockstart)
  243.     {
  244.         pulled = 0;
  245.     }
  246.     else if (GetSenderRef() == lowblockend)
  247.     {
  248.         pulled = 1;
  249.     }
  250.  
  251.     # if sinker was waiting for block to arrive, tell it to fall after a short delay
  252.     if (sinkerwaiting)
  253.     {
  254.         Sleep(Rand() * 2);
  255.         call timer;
  256.     }
  257.     
  258.     sinkerwaiting = 0;
  259.     
  260.     return;
  261.  
  262. exited:
  263. # ---> either of two pushblock faces (masked for pushblocks only)
  264.     pushermoving = 1;
  265.     return;
  266.  
  267. startscene:
  268.     call fixcams;
  269.     SetCameraFocus(2, blockcam);
  270.     SetCameraSecondaryFocus(2, blockcamlook);
  271.     SetCurrentCamera(2);
  272.     return;
  273.         
  274. fixcams:
  275.     #reset camera settings
  276.     ResetCameraFOV(0, 0);
  277.     SetCameraLookInterp(2, 0);
  278.     SetCameraPosInterp(2, 0);
  279.     SetCameraPosInterp(1, 0);
  280.     SetCameraLookInterp(1, 0);
  281.     return;
  282.  
  283. pulse:
  284.     if (counter > 1)
  285.     {
  286.         counter = counter - 1;
  287.         
  288.         SetPOVShake(VectorScale(VectorSet(RandBetween(-1, 1), RandBetween(-1, 1), RandBetween(-1, 1)), .0005 * counter),
  289.                     VectorScale(VectorSet(RandBetween(-2, 2), RandBetween(-2, 2), RandBetween(-2, 2)), .05 * counter),
  290.                     10, 180);
  291.     }
  292.     else
  293.     {
  294.         SetPulse(0);
  295.         counter=10;
  296.     }
  297.  
  298.     return;
  299. end
  300.